package com.application.controller;


import com.application.domain.Main;
import com.application.service.MainService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/main")
@ApiOperation("主页")
public class MainController {

    @Resource
    MainService mainService;


    @GetMapping
    @ApiOperation("获取信息")
    public Result getAll(){
        List<Main> all = mainService.getAll();

        Integer code = all!=null ?Code.SELECT_OK:Code.SELECT_ERR;
        String mes = all!=null ? "查询成功":"查询失败";
        return new Result(code,all,mes);
    }
}
